#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "LED.h"
#include "OLED.h"
#include "EXTI_Common.h"
#include "Timer.h"
#include "PWM.h"

uint16_t num;
		uint8_t i;

int main(void)
{
//	EXTI_InitCommon();
	OLED_Init();
	OLED_ShowString(1,1,"Num:");
	OLED_ShowString(2,1,"CNT:");
	PWM_Init();
	
//	Timer_Init2();
	
	while(1)
	{
//		OLED_ShowNum(1,5, num,5);
//		OLED_ShowNum(2,5, Timer_GetCounter(),5);
		for(i=0;i<=100;i++)
		{
			PWM_SetCompare1(i);
			Delay_ms(10);
		}
		for(i=0;i<=100;i++)
		{
			PWM_SetCompare1(100-i);
			Delay_ms(10);
		}
	}
}



void TIM2_IRQHandler()
{
	if(TIM_GetITStatus(TIM2, TIM_IT_Update)== SET)
	{
		num++;
		TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
	}
}
